<template>
	<div class="weui-panel" style="height: 100%;width: 100%; background-color:#efefef ;">
		<div class="weui-cell" style="padding: 0.5rem;border-bottom: #d8d8d8;">
			<input type="button" class="btn returnBtn" @click="goBack" value="返回"></input>
			<input type="button" class="btn" style="display: flex;margin-left: 65%;padding: 3px 8px;" value="新增"
				@click="showAdd"></input>
		</div>
		<div class="weui-panel__bd" style="background-color: white;">
			<div class="weui-cells">
				<a @click="showAdd(item)" class="weui-media-box weui-media-box_appmsg"
					v-for="(item, index) in caseTyps">
					<div class="weui-media-box__hd">
						<img class="weui-media-box__thumb" src="../../assets/img/manager/type.png">
					</div>
					<div class="weui-media-box__bd" style="text-align: left;">
						<h4 class="weui-media-box__title">类型:{{item.caseTypeName}}</h4>
					</div>
				</a>
			</div>
		</div>


	</div>


</template>

<script>
	import {
		showMsg
	} from '@/apis/common/common.js'
	import apis from '@/utils/apis.js'
	import {
		getCaseTyeList,
	} from '@/apis/tech/tech.js'
	import constant from '@/utils/constant'

	export default {
		data() {
			return {
				account: "",
				caseTyps: [],

				showAddFlag: false,
			}
		},
		created() {
			debugger
			this.getCaseTyeList();
		},
		methods: {
			//获取所有类型信息
			getCaseTyeList() {
				this.caseTyps = [];
				getCaseTyeList(apis.getCaseTyeList+"?flag=tech").then(res => {
					if (res.resultCode == constant.SUCCESS && res.data) {
						this.caseTyps = res.data;
					}
				})
			},
			showAdd(item) {
				if (item) {
					//修改
					this.$router.push({
						name: "addCaseTypeInfo",
						params: {
							caseType: item
						}
					})
				} else {
					//新增
					this.$router.push({
						name: "addCaseTypeInfo",
						params: {
							caseType: null
						}
					})
				}
			},
			goBack() {
				this.$router.go(-1);
			},

		}
	}
</script>

<style scoped>
	@import "../../assets/css/returnBtn.css";

	.dialog {
		width: 100%;
		height: 40%;
		position: absolute;
		background-color: white;
		margin-top: 30%;
		font-size: 1rem;
	}
</style>
